<template>
	<view>
		<smh-address-indexed :list='list' :letter="'A'" @confirm="confrim"></smh-address-indexed>
	</view>
</template>

<script>
	import {city} from  "@/components/city.js";
	export default {
		data() {
			return {
				list:[],
				type:''
			};
		},
		onLoad(option) {
			this.list=city;
			// this.cityList.forEach()
			this.type=option.id
		},
		methods: {
			confrim(e) {
				console.log(e) //=>{id:123,name:'北京'}
				var pages = getCurrentPages();
				var prevPage = pages[pages.length - 2];
				let nowPage = pages[ pages.length - 1];  //当前页页面实例
				if(this.type==1){
					prevPage.brand = e;
				}
				if(this.type==2){
					prevPage.brands = e;
				}
				if(this.type==3){
					prevPage.branda = e;
				}
				if(this.type==4){
					prevPage.brandas = e;
				}
				uni.navigateBack({
					delta: 1
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
